<template>
<table class="table-bordered" border="1">
    <tr>
        <td>投资项目名称</td>
        <td><input v-model="a.name" type="text"></td>
    </tr>
   
    <tr>
        <td>投资总金额</td>
        <td><input v-model="a.moneys" type="text"></td>
    </tr>
    <tr>
        <td colspan="2"><input type="button" value="发布" @click="add" class="btn btn-success"></td>
    </tr>
</table>
</template>
<script setup lang="ts">
import axios from 'axios';

import { ref } from 'vue';
import router from '../router';
const a = ref({
    name:"",
    moneys:"",
});
const add=()=>{
    axios({
        url:"https://localhost:44366/api/Invest/Add",
        data:{
            T_TnecestName:a.value.name,
            T_TnecestBudget:a.value.moneys,
            
        },
        method:"post",
    })
    .then(res=>{
        if(res.data>0){
            alert("发布成功");
            router.push("/Show");
        }else{
            alert("发布失败");
        }
    })
    .catch(err=>{
        console.log(err);
    })
}

</script>